// 压缩文件夹
const pushZip = (fs, zip, path) => {
  const files = fs.readdirSync(path, {
    withFileTypes: true
  });
  files.forEach(file => {
    const fileName = file.name
    let filePath = `${path}/${file.name}`;
    if (file.isDirectory()) {
      pushZip(fs, zip.folder(fileName), filePath);
    } else {
      zip.file(fileName, fs.readFileSync(filePath));
    }
  });
}

module.exports = {
  pushZip
}